﻿var _{{id}} = (function() {
    var gauge = new JustGage({
        id: "{{id}}", 
        value: 0, 
        min: 0,
        max: 100,
        title: "{{title}}",
        label: "{{label}}",
        valueFontColor: "#cacaca",
        relativeGaugeSize: true
    }); 

    return {
        update: function(payload) {
            var data = JSON.parse(payload);

            if (data.max) {
                gauge.refresh(data.value, data.max);
            } else {
                gauge.refresh(data.value);
            }
        }
    }
}());
